package com.xms.utils;

import java.util.UUID;

/**
 * <p>
 * UUIDUtil
 * </p>
 *
 * @author migo
 * @since 2021/9/2
 */
public class UUIDUtil {
    public static final UUID Empty = UUID.fromString("00000000-0000-0000-0000-000000000000");

    public static UUID get(){
        return UUID.randomUUID();
    }

    public static UUID get(String s){
        try {
            return UUID.fromString(s);
        }catch (IllegalArgumentException e){
            return null;
        }
    }

    public static boolean isEmpty(UUID value){
        return value == null || value.equals(Empty);
    }
    public static boolean notEmpty(UUID value){
        return value != null && !value.equals(Empty);
    }
}
